Thread support library (C++0x)

From Cppreference

< cpp
Jump to: navigation, search

The standard thread support library provides portable way to construct threads and to manage them.

Contents

[edit] Thread management

Class thread manages a separate thread.

There are several thread related functions defined in std::this_thread namespace:

Defined in header <thread>
yield
hints the implementation to reschedule execution of threads
(function)
get_id
returns the thread id of the current thread
(function)
sleep_for
stops the execution of the current thread for a specified time duration
(function)
sleep_until
stops the execution of the current thread until a specified time point
(function)

[edit] Mutual exclusion

Several classes are provided that manage mutexes: mutex, recursive_mutex, timed_mutex, recursive_timed_mutex.

Several class templates are provided for generic mutex management: lock_guard, unique_lock.

once_flag

Several helper functions are provided for mutex locking:

Defined in header <mutex>
try_lock
tries to lock specified mutexes or locks, returns if at least one is unavailable
(function)
lock
locks specified mutexes/locks, blocks if at least one is unavailable
(function)
call_once

(function)

[edit] Condition variables

[edit] Futures

Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox
In other languages